export const idCard = /^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/;

export const mobileReg = /^1[2-9]\d{9}$/;

// TODO：隐藏手机号中间四位，可扩为隐藏各种字符
export const hidePhone = phone => {
  var reg = /^(\d{3})\d{4}(\d{4})$/
  return phone.replace(reg, "$1****$2")
}

export const address = val => {
  const value = val.trim();
  return value.length >= 5 && value.length <= 100;
};

export const userName = /^[a-zA-Z0-9_\u4e00-\u9fa5]{3,20}$/;

export const emailReg = /^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$/;

export const bankReg = /^([1-9]{1})(\d{14}|\d{18})$/;

export const nameReg = /^[a-zA-Z0-9_\u4e00-\u9fa5]{2,20}$/;